<!--
 * @Author: your name
 * @Date: 2020-03-06 00:26:23
 * @LastEditTime: 2020-03-06 00:36:36
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \js_homework\01作业鼠标事件\index.html
 -->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        .box{
            width: 200px;
            height: 50px;
            line-height: 50px;
            background-color: #666;
            border: 1px solid #000;
            color: #fff;
            margin: 50px auto 0;
            text-align: center;
        }
    </style>
</head>
<body>
    <div class="box"></div>
    <div class="box"></div>
    <script>
        var aBox = document.querySelectorAll(".box");
        aBox[0].onmouseenter = function(){
            aBox[1].innerHTML = "移入了box1"
        }
        aBox[0].onmouseleave = function(){
            aBox[1].innerHTML = ""
        }
        aBox[1].onmouseenter = function(){
            aBox[0].innerHTML = "移入了box2"
        }
        aBox[1].onmouseleave = function(){
            aBox[0].innerHTML = ""
        }
    </script>
</body>
</html>